/**
 * FyLLGen - A Java based tool for collecting and distributing family data
 *
 * Copyright (C) 2007-2011 Christian Packenius
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package de.chris_soft.fyllgen.menu.file;

import org.eclipse.swt.printing.Printer;
import org.eclipse.swt.printing.PrinterData;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

import de.chris_soft.fyllgen.GUI;
import de.chris_soft.fyllgen.utilities.SwtUtilities;

/**
 * Druckt die aktuelle Familienansicht auf dem Standarddrucker.
 * @author Christian Packenius, Juli 2008.
 */
public class ImmediatellyPrintingFamilyView implements Listener {
  /**
   * Startet den Druck.
   * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
   */
  public void handleEvent(Event event) {
    PrinterData data = Printer.getDefaultPrinterData();
    if (data == null) {
      SwtUtilities.sayError(GUI.instance.shell, "Kein Standarddrucker vorhanden!");
    }
    else {
      SwtUtilities.sayError(GUI.instance.shell, "Druck noch nicht realisiert!");
      // Printer printer = new Printer(data);
      // if (printer.startJob("FyLLGen - Family view print job")) {
      // GC gc = new GC(printer);
      // if (printer.startPage()) {
      // Consts.getGui().getFamilyComposite().print(gc);
      // printer.endPage();
      // }
      // gc.dispose();
      // printer.endJob();
      // }
    }
  }
}
